import { get } from 'lodash-es'

export class ReservationPrepay {
  id?: string
  hotel_id?: string
  openid?: string
  appid?: string
  mchid?: string
  confirm_number?: string
  resv_name_id?: string
  primary_confirm_number?: string
  primary_resv_name_id?: string
  out_trade_no?: string
  wx_transaction_id?: string
  prepay_id?: string
  expires_at?: string
  amount?: number
  paid_status?: string
  paid_time?: string
  share_deposit_rule?: string
  is_pms_posted?: boolean
  is_refund?: boolean
  created_at?: string
  updated_at?: string
  version?: number;
  [key: string]: any

  constructor(data?: ReservationPrepay) {
    this.init(data)
  }
}

ReservationPrepay.prototype.init = function init(data?: ReservationPrepay) {
  this.id = get(data, 'id')
  this.hotel_id = get(data, 'hotel_id')
  this.openid = get(data, 'openid')
  this.appid = get(data, 'appid')
  this.mchid = get(data, 'mchid')
  this.confirm_number = get(data, 'confirm_number')
  this.resv_name_id = get(data, 'resv_name_id')
  this.primary_confirm_number = get(data, 'primary_confirm_number')
  this.primary_resv_name_id = get(data, 'primary_resv_name_id')
  this.out_trade_no = get(data, 'out_trade_no')
  this.wx_transaction_id = get(data, 'wx_transaction_id')
  this.prepay_id = get(data, 'prepay_id')
  this.expires_at = get(data, 'expires_at')
  this.amount = get(data, 'amount')
  this.paid_status = get(data, 'paid_status')
  this.paid_time = get(data, 'paid_time')
  this.share_deposit_rule = get(data, 'share_deposit_rule')
  this.is_pms_posted = get(data, 'is_pms_posted')
  this.is_refund = get(data, 'is_refund')
  this.created_at = get(data, 'created_at')
  this.updated_at = get(data, 'updated_id')
  this.version = get(data, 'version')
}
